#!/bin/bash
j_script_dir=`dirname $0`
j_jenny_root_dir=`(cd $j_script_dir/..; pwd)`

. $j_jenny_root_dir/common/function

usage() {
	echo "jenny update"
	echo "    update jenny settings"
	exit 1
}

if [ "$1" = "-h" ]; then 
	usage
fi

append_or_update_alias(){
	local cmd="alias jenny='~/.jenny/jenny/jenny'"
	if ! grep "$cmd" $1; then
		echo $cmd >> $1
	fi
}

append_or_update_alias ~/.bash_profile 2>&1 > /dev/null
append_or_update_alias ~/.bashrc 2>&1 > /dev/null
(cd $j_script_dir; git pull)
sync_cmake

if [ ! -f ~/.jenny/NuGet.config ]; then 
	cp  $j_jenny_root_dir/misc/NuGet.config ~/.jenny/ 
fi
echo echo you may need to set account info in ~/.jenny/NuGet.config manually

echo Done.
